Skip to content

Conversation

@zrlw
Copy link
Contributor

@zrlw zrlw commented Nov 5, 2025

What's Changed

  1. Remove jdk9-compile profile configuration from pom.xml. For now, Unsafe will be considered as nonexistent package if set maven.compiler.release, no matter the release is set to 8 or not. see details at There are difference between maven.compiler.release and maven.compiler.target during compiling projects which use sun.misc.Unsafe with JDK17+ maven-compiler-plugin#990
  2. Call position method of java.nio.Buffer instead of java.nio.ByteBuffer for the sake of jdk8 compatibility since position method had been moved from java.nio.Buffer to its subclass java.nio.ByteBuffer since jdk9+.

What is the purpose of the change?

The release configuration of jdk9-compile profile will cause trouble if we compile dubbo with jdk17+ and use sun.misc.Unsafe like this,

import sun.misc.Unsafe;

import static org.apache.dubbo.common.constants.CommonConstants.ThirdPartyProperty.GRAALVM_NATIVEIMAGE_IMAGECODE;

public abstract class NativeDetector {
    private Unsafe UNSAFE;
    ...
ea662096be573fa8a1eda6ec827d166c

Cause

sun.misc.Unsafe had been moved to jdk.unsupported module since jdk9+, it could not be added if set maven.compiler.release

When using --release to specify a release that supports the Java Platform Module System, the --add-exports option cannot be used to enlarge the set of packages exported by the Java SE, JDK, and standard modules in the specified release.

see details at https://docs.oracle.com/en/java/javase/25/docs/specs/man/javac.html#option-release

Checklist

  • Make sure there is a GitHub_issue field for the change.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit-test to verify your logic correction. If the new feature or significant change is committed, please remember to add sample in dubbo samples project.
  • Make sure gitHub actions can pass. Why the workflow is failing and how to fix it?

@codecov-commenter
Copy link

codecov-commenter commented Nov 5, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 60.75%. Comparing base (f284fab) to head (527e23b).

Additional details and impacted files
@@             Coverage Diff              @@
##                3.3   #15755      +/-   ##
============================================
- Coverage     60.76%   60.75%   -0.02%     
+ Complexity    11712    11692      -20     
============================================
  Files          1938     1938              
  Lines         88646    88646              
  Branches      13379    13379              
============================================
- Hits          53866    53857       -9     
- Misses        29257    29260       +3     
- Partials       5523     5529       +6     
Flag Coverage Δ
integration-tests-java21 32.38% <100.00%> (-0.08%) ⬇️
integration-tests-java8 32.44% <100.00%> (+<0.01%) ⬆️
samples-tests-java21 32.06% <100.00%> (+0.02%) ⬆️
samples-tests-java8 29.72% <100.00%> (+0.12%) ⬆️
unit-tests-java11 59.05% <100.00%> (-0.03%) ⬇️
unit-tests-java17 58.53% <100.00%> (-0.02%) ⬇️
unit-tests-java21 58.55% <100.00%> (-0.02%) ⬇️
unit-tests-java25 58.53% <100.00%> (+0.02%) ⬆️
unit-tests-java8 59.08% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@zrlw zrlw force-pushed the 3.3-remove-jdk-compile-profile branch 2 times, most recently from e3333f1 to 9a3e96c Compare November 5, 2025 15:52
@zrlw zrlw changed the title Remove jdk9-compile profile from pom.xml Replace jdk9-compile profile release configuration with maven.compiler.target property Nov 5, 2025
@zrlw zrlw changed the title Replace jdk9-compile profile release configuration with maven.compiler.target property Replace jdk9-compile profile maven release configuration with maven.compiler.target property Nov 5, 2025
@zrlw zrlw changed the title Replace jdk9-compile profile maven release configuration with maven.compiler.target property Replace jdk9-compile profile maven compiler release configuration with maven.compiler.target property Nov 5, 2025
@zrlw zrlw force-pushed the 3.3-remove-jdk-compile-profile branch from 9a3e96c to fc46032 Compare November 6, 2025 01:53
@zrlw zrlw changed the title Replace jdk9-compile profile maven compiler release configuration with maven.compiler.target property Remove jdk9-compile profile from pom.xml Nov 6, 2025
@zrlw zrlw force-pushed the 3.3-remove-jdk-compile-profile branch from fc46032 to 1f76507 Compare November 6, 2025 02:47
@zrlw zrlw force-pushed the 3.3-remove-jdk-compile-profile branch from 1f76507 to 31feb7e Compare November 6, 2025 02:50
@zrlw zrlw requested review from AlbumenJ and CrazyHZM November 10, 2025 02:10
@zrlw zrlw changed the title Remove jdk9-compile profile from pom.xml Remove jdk9-compile profile from pom.xml to support Unsafe compilation at jdk9+ Nov 13, 2025
@zrlw zrlw added the type/bug Bugs to being fixed label Nov 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type/bug Bugs to being fixed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants